import { Component, Input, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { ArticleListVo } from '../../vo/article-list-vo';

@Component({
  selector: 'app-article-card',
  templateUrl: './article-card.component.html',
  styleUrls: ['./article-card.component.scss']
})
export class ArticleCardComponent implements OnInit {


  @Input()
  articleListVo: ArticleListVo;

  @Input()
  type: number;

  constructor(
    private route: ActivatedRoute,
    private router: Router,
    ) {

  }

  ngOnInit(): void {
    console.log(this.type);

  }

  public toDate(date: Date): String {
    return date.toString().replace('T', ' ').split('.')[0];
  }

  toArticle(articleId: string){
    this.router.navigate(['blog/articlePage', {'articleId':articleId}]);
  }

}
